package com.example.demo.service;

import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
@Service
@RequestMapping("/service")
// 替代之前需要通过 LoggerFactory.getLogger() 操作
@Slf4j
public class UserService {

//    private static final Logger logger =
//            LoggerFactory.getLogger(UserService.class);

    @ResponseBody
    @RequestMapping("/test")
    public void test() {
        // 此时日志打印对象名只能是 log
        log.trace("Server包 trace 级别");
        log.debug("Server包 debug 级别");
        log.info("Server包 info 级别");
        log.warn("Server包 warn 级别");
        log.error("Server包 error 级别");
    }
}
